Skip to content

fix(contract): device.exec refuses a stdin over 8 MiB with BAD_REQUEST - #1318

Merged
V3RON merged 6 commits into
mainfrom
bug/1242
Nov 5, 2026
Merged

V3RON merged 6 commits into
mainfrom
bug/1242

Conversation

@V3RON

@V3RON V3RON commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1242

Status

Implement: done (2/2 green) Review: round 2 + fix-check passed, 0 open Hardware: n/a Gate: running
Next: gate

Done when:

  • A device.exec whose stdin is longer than 8,388,608 characters is refused with BAD_REQUEST and nothing is forwarded to the worker; one at the limit still runs — src/gateway/dispatcher.test.ts (8,388,608 forwarded, 8,388,609 refused, nothing forwarded) and src/http/app.test.ts (HTTP 400), red with the .max removed

Assumptions

  • Assumption: docs wording — the cap is stated on the pages that describe stdin (remote agents, working with a device, programmatic client, device-exec flow).

Review

Spec review: 0 blocking, 0 fixed, 0 notes. Code review: 2 blocking, 2 fixed, 2 notes. Claims review: 0 blocking, 0 fixed, 0 notes.
Rounds: 2. Tokens: 3.5M.
Runs: 12. Cost USD: 3.4762. Agent seconds: 1466.

Assessment: complete

Written by an agent.

@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change limits optional device.exec stdin to 8,388,608 characters. The contract and lease execution request schema reject larger values. Tests cover input at the limit and one character above it, including checks that invalid input is not dispatched. Documentation for the worker flow, HTTP API, CLI, programmatic client, and agent tools now states the limit and rejection behavior.

Suggested reviewers: leonardoxr

Severity of issue fixed: High

Merge Risk: Minimal · up to 35cf3

The stdin limit is documented and validated; no merge-blocking issue was identified.

Security architecture risk: Minimal · up to 35cf3

The change tightens input validation without expanding command access or weakening lease ownership checks. Oversized input is rejected before worker forwarding, and boundary tests cover acceptance at the limit and rejection above it. No material security risk introduced or worsened by this change was found.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — For requests entering the inspected gateway and HTTP paths, the newly refused inputs cannot reach worker execution. The change reduces accepted input rather than adding callers, device scope, or execution authority.

Trust Boundaries and Controls

  • observed — Accepted device.exec requests retain the existing role and lease-identity checks. Non-admin callers cannot supply requesterId and must match the known lease owner; admin callers must match the known lease requester using the explicit requesterId or their principal. These controls are unchanged by the PR.

Resilience and Maintainability Implications

  • inferred — The new rejection is a stateless pre-handler decision. It introduces no lease reservation, partial device operation, or recovery transition: repeated or concurrent oversized requests fail before coordinator invocation, so this rejection requires no compensating cleanup.
Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title names the main change: device.exec now refuses stdin over 8 MiB with BAD_REQUEST. The raw summary shows the new EXEC_STDIN_MAX_LENGTH limit in the contract schema, the HTTP lease schema, and…
Description check Passed The description ties the change to the stdin size limit for device.exec. It names the test files that cover the boundary, the BAD_REQUEST refusal, and the docs assumption. This relates directly to the…
Linked Issues check Passed Issue #1242 identifies a per-request stdin bound as a suggested fix. The PR adds EXEC_STDIN_MAX_LENGTH with value 8,388,608 and applies it to the device.exec contract and HTTP lease schema. Boun…
Out of Scope Changes check Passed The changed contract and HTTP schema implement the device.exec limit for issue #1242. Dispatcher and HTTP tests verify the boundary and rejection behavior. Documentation changes describe the same li…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Title check

Explanation

The title names the main change: device.exec now refuses stdin over 8 MiB with BAD_REQUEST. The raw summary shows the new EXEC_STDIN_MAX_LENGTH limit in the contract schema, the HTTP lease schema, and tests for the boundary. The title matches the changeset.

Full details: Description check

Explanation

The description ties the change to the stdin size limit for device.exec. It names the test files that cover the boundary, the BAD_REQUEST refusal, and the docs assumption. This relates directly to the changeset, so the check passes.

Full details: Linked Issues check

Explanation

Issue #1242 identifies a per-request stdin bound as a suggested fix. The PR adds EXEC_STDIN_MAX_LENGTH with value 8,388,608 and applies it to the device.exec contract and HTTP lease schema. Boundary tests verify forwarding at 8,388,608 characters and BAD_REQUEST with no worker call at 8,388,609 characters. The issue also suggests an in-flight aggregate limit, streaming or an upload endpoint, and lease persistence. These are suggestions, not stated acceptance criteria, and the PR does not claim to implement them.

Full details: Out of Scope Changes check

Explanation

The changed contract and HTTP schema implement the device.exec limit for issue #1242. Dispatcher and HTTP tests verify the boundary and rejection behavior. Documentation changes describe the same limit and error. The source-hygiene baseline changes support the added tests. No changed file shows unrelated behavior.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 5 files.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: QUIET
  • Plan: Advanced
  • Run ID: 7df0bf68-7a5c-4a68-8aea-7bceb504b028
Commits

Reviewing files that changed from the base of the PR and between c86a19d and 35cf344.

Files selected for processing: 2

  • src/gateway/dispatcher.test.ts
  • src/source-hygiene.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

@V3RON

V3RON commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Review ledger

Round 1: 5eba706
Round 2: eeac275
Round fix-check: e3e7f6d

Runs: 12. Cost USD: 3.4762. Agent seconds: 1466.
Tokens input 251, output 72389, cache read 5429051, cache write 555626.
- build implementer: claude-sonnet-5-5 193 s $0.3445
- audit implementer: claude-sonnet-5-5 40 s $0.1372
- review 1 reviewer: claude-sonnet-5-5 339 s $0.3458
- review 1 spec: claude-sonnet-5-5 21 s $0.0975
- review 1 code both: claude-opus-5-5 211 s $0.8983
- review 1 claims: claude-sonnet-5-5 24 s $0.1162
- fix 1 implementer: claude-sonnet-5-5 68 s $0.1637
- review 2 reviewer: claude-sonnet-5-5 290 s $0.2542
- review 2 code both: claude-opus-5-5 180 s $0.7415
- review 2 claims: claude-sonnet-5-5 37 s $0.1911
- fix 2 implementer: claude-sonnet-5-5 30 s $0.0847
- review fix-check reviewer: claude-sonnet-5-5 33 s $0.1015
Finding outcomes: {"duplicate":1,"fixed":2}. Classes: {"documentation 9":3}.
{"findings":[{"id":"R1","role":"code","class":"documentation 9","outcome":"fixed","path":"website/src/content/docs/docs/reference/cli.mdx","round":"1","fix":"eeac27598f282d8d416fc15ecf832c932ac15780"},{"id":"R2","role":"code","class":"documentation 9","outcome":"fixed","path":"website/src/content/docs/docs/getting-started/connect-your-agent.mdx","round":"2","fix":"e3e7f6d7a216576313756bfd32592b765570e1f8"},{"id":"R2dup","role":"claims","class":"documentation 9","outcome":"duplicate","canonicalId":"R2","path":"website/src/content/docs/docs/getting-started/connect-your-agent.mdx","round":"2"}]}

Written by an agent.

@V3RON

V3RON commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Review notes

Not blocking, not verified. Each is one reviewer's claim.

  • code: src/http/app.ts and src/daemon/server.ts:778 still read the whole HTTP body or socket line before the stdin cap refuses it, and a local socket line has no length cap (named in the triage report).
  • code: anyone sending more than 8 MiB of stdin today (tester-army, budgie) breaks with this change; the release notes should say so.

Written by an agent.

@V3RON
V3RON marked this pull request as ready for review November 5, 2026 14:22
@V3RON V3RON closed this Nov 5, 2026
@V3RON V3RON reopened this Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Worker aborts with V8 OOM in JSON.parse when several exec requests carry large stdin payloads; all leases lost

1 participant